   var key='F713CDFC0C491CDE280DB1B38C93A624F713CDFC0C491CDE';
   function strToHexCharCode(str) {
　　if(str === "")
　　　　return "";
　　var hexCharCode = [];
　　hexCharCode.push("0x"); 
　　for(var i = 0; i < str.length; i++) {
　　　　hexCharCode.push((str.charCodeAt(i)).toString(16));
　　}
　　return hexCharCode.join("");
}
   
   function hexCharCodeToStr(hexCharCodeStr) {
　　var trimedStr = hexCharCodeStr.trim();
　　var rawStr = 
　　trimedStr.substr(0,2).toLowerCase() === "0x"
　　? 
　　trimedStr.substr(2) 
　　: 
　　trimedStr;
　　var len = rawStr.length;
　　if(len % 2 !== 0) {
　　　　console.log("Illegal Format ASCII Code!");
　　　　return "";
　　}
　　var curCharCode;
　　var resultStr = [];
　　for(var i = 0; i < len;i = i + 2) {
　　　　curCharCode = parseInt(rawStr.substr(i, 2), 16); // ASCII Code Value
　　　　resultStr.push(String.fromCharCode(curCharCode));
　　}
　　return resultStr.join("");
}
   //加密
//DES ECB模式加密
function encryptByDESModeEBC(key, message){
	var message1 = strToHexCharCode(message);
	var keyHex = CryptoJS.enc.Hex.parse(key);
	var messageT = CryptoJS.enc.Hex.parse(message1);
	var encrypted = CryptoJS.TripleDES.encrypt(messageT, keyHex, {
		mode: CryptoJS.mode.ECB,
		padding: CryptoJS.pad.Pkcs7
	});  
	var result_value = encrypted.ciphertext.toString(CryptoJS.enc.Hex);
	return result_value;
}

//DES  ECB模式解密
function decryptByDESModeEBC(key, ciphertext){
	var keyHex = CryptoJS.enc.Hex.parse(key);
	var decrypted = CryptoJS.TripleDES.decrypt({
		ciphertext: CryptoJS.enc.Hex.parse(ciphertext)
	}, keyHex, {
		mode: CryptoJS.mode.ECB,
		padding: CryptoJS.pad.NoPadding
	});
	var result_value = decrypted.toString(CryptoJS.enc.Hex);
	return hexCharCodeToStr(result_value);
}

function formateDataRes(res){  //处理返回数据结果
	var result = decryptByDESModeEBC(key, res);
	var lastIndex = result.lastIndexOf('}');
	result= result.substring(0,lastIndex+1);  
	 //	console.log(result);
	result = JSON.parse(result);
	return result;
}

  function showWarn(a){//下面的提示框
  	var str = '<div class="warnTitle">'+a+'</div>'
  	$('body').append(str);
  	$('.warnTitle').show()
	$('.warnTitle').fadeOut(4000,function(){
		$('.warnTitle').remove();
	})
  }
  
  function formateDate(a,b){  //格式化日期
	var oldTime = a+' '+b
	var time = new Date(oldTime)
	var year = time.getFullYear();
	var month = time.getMonth()+1;
	var day = time.getDate();
	var hour = time.getHours();
	var min = time.getMinutes();
	var second = time.getSeconds();     
	return year+'年'+month+'月'+day+'日'+' '+hour+':'+min+':'+second;
  }
  
  function formateDate2(a){//格式化日期
  	var year = a.substring(0,4);
	var month = a.substring(4,6);
	var day = a.substring(6,8);
	var hour = a.substring(8,10);
	var min = a.substring(10,12);
	var second = a.substring(12,14);
	return year+'年'+month+'月'+day+'日'+' '+hour+':'+min+':'+second;
  }
  
  function yanzheng(a){//验证规则     不能连续的2个空格  不能出现？号
	a=a.replace(/\s\s\s*/g,' ');
	a = a.replace(/\?/g,'');	
	return a;
 }
  
  
  function checkNumLetter(str){//只能输入数字和字母
	return /^[\da-z]+$/i.test(str);
 }
 function getClickTime(){
 	var nowDate = new Date();
	var year = nowDate.getFullYear();
	var month = nowDate.getMonth()+1;
	month = month<=9?'0'+month:month;
	var day = nowDate.getDate();
	day = day<=9?'0'+day:day;
	var hour = nowDate.getHours();
	hour = hour<=9?'0'+hour:hour;
	var min = nowDate.getMinutes();
	min = min<=9?'0'+min:min;
	var seconds = nowDate.getSeconds();
	seconds = seconds<=9?'0'+seconds:seconds;
	var todayDate = String(year) +String(month)+String(day)+String(hour)+String(min)+String(seconds);
	return todayDate;
 }
 
 function goback(){
 	history.back();
 }
  
 
 
 
 
  
  
